import cv2
import numpy as np

def points_rect_judge(laser_point, outer_rect, inner_rect):
    # 将顶点转换为 OpenCV 期望的格式
    outer_rect = outer_rect.reshape((-1, 1, 2))
    inner_rect = inner_rect.reshape((-1, 1, 2))
    # 使用 cv2.pointPolygonTest 判断点的位置
    outer_result = cv2.pointPolygonTest(outer_rect, laser_point, False)
    inner_result = cv2.pointPolygonTest(inner_rect, laser_point, False)
    if outer_result == -1:
        return -1
    elif inner_result ==-1 and outer_result == 1:
        return 0
    elif inner_result == 1:
        return 1